/**
 * 
 */
package com.roshan.util;

import java.net.URI;
import java.net.URISyntaxException;

import org.springframework.util.StringUtils;

@SuppressWarnings("nls")
public final class RoarURISpec {

    public static String getUUID(URI uri) {
        return uri.getFragment();
    }

    public static boolean isRoarURI(String uri) {
        try {

            return isRoarURI(new URI(uri));
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("The string does not consist of a valid URI", e);
        }
    }

    public static boolean isRoarURI(URI uri) {
        return StringUtils.hasText(uri.getSchemeSpecificPart()) && StringUtils.hasText(uri.getFragment());

    }

}
